const express=require('express')
const router= express.Router();
const db=require('../../utils/db')

// 查询收银流水
router.get('/getcashierwater',function(req,res){
    let mysql=`select * from cash_flowing join order_information in cash_flowing.cash_num=order_information.order_id`
    db(mysql,null,function(err,data){
        if(err){
            return res.json({
                code: 500,
                msg: '查询收银流水失败，请稍后重试'
            })
        }
        res.json({
            code: 200,
            msg: '查询收银流水成功',
            data: data
        })
    })
})

// 模糊查询单号
router.post('/getorderid',function(req,res){
    let mysql=`select * from cash_flowing join order_information in cash_flowing.cash_num=order_information.order_id 
               where order_id like ${req.order_id}`
    db(mysql,null,function(err,data){
        if(err){
            return res.json({
                code: 500,
                msg: '模糊查询单号失败，请稍后重试'
            })
        }
        res.json({
            code: 200,
            msg: '模糊查询单号成功',
            data: data
        })
    })
})




module.exports = router